﻿using KouDai.Core.ViewModel;
using KouDai.Metro.Common;
using System.Collections.Generic;
using KouDai.Core.Service;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media.Imaging;
using Windows.UI.Xaml;
using Windows.Foundation;
using System.Net;

// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238

namespace KouDai.Metro
{
    /// <summary>
    /// An empty page that can be used on its own or navigated to within a Frame.
    /// </summary>
    public sealed partial class MainPage : LayoutAwarePage
    {
        private MainViewModel _main;

        public MainPage()
        {
            this.InitializeComponent();
            _main = this.DataContext as MainViewModel;
        }

        protected override async void LoadState(object navigationParameter, Dictionary<string, object> pageState)
        {
            base.LoadState(navigationParameter, pageState);
            await _main.GetItems();
        }
    }
}
